FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["HaiFengShop.API/HaiFengShop.API.csproj", "HaiFengShop.API/"]
COPY ["HaiFengShop.Entity/HaiFengShop.Entity.csproj", "HaiFengShop.Entity/"]
COPY ["HaiFengShop.ORM/HaiFengShop.ORM.csproj", "HaiFengShop.ORM/"]
COPY ["HaiFengShop.Tools/HaiFengShop.Tools.csproj", "HaiFengShop.Tools/"]
COPY ["HaiFengShop.Service/HaiFengShop.Service.csproj", "HaiFengShop.Service/"]
RUN dotnet restore "HaiFengShop.API/HaiFengShop.API.csproj"
COPY . .
WORKDIR "/src/HaiFengShop.API"
RUN dotnet build "HaiFengShop.API.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "HaiFengShop.API.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HaiFengShop.API.dll"]